//headers
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
//macros
#define LET(x,a) typeof(a) x(a)
#define FOR(i,a,n) for(LET(i,a);i<n;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define sz size()
#define pb push_back
#define LL long long
#define PRINT(x) REP(i,x.sz) cout<<x[i]<<" ";
#define VS vector<string>
#define VI vector<int>
#define VII vector< VI >

//code of suren

class ImageDithering {
public:
	int count(string, vector <string>);
};

int ImageDithering::count(string dith, vector <string> screen) {
	int count=0;
	REP(i,screen.sz) REP(j,screen[i].sz) 
		REP(k,dith.sz) if(screen[i][j]==dith[k]) { count++; break; }
	return count;	
	
}


//Powered by [KawigiEdit] 2.0!
